<!DOCTYPE html>
{% load static %}
<html>
<head>
    <meta charset="UTF-8">
    <title>CT检测结果</title>
    <link rel="preconnect" href="https://fonts.gstatic.com">

    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">

    <!--图标库-->
    <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css'>

    <!--核心样式-->
    <link rel="stylesheet" href="{% static 'other/css/result/style.css' %}">
    <link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
</head>
<body>

<div class='app'>
    <main class='project'>
        <div class='project-info'>
            <h1>CT检测结果</h1>
        </div>
        <div class='project-tasks'>
            <div class='project-column'>
                <div class='project-column-heading'>
                    <h2 class='project-column-heading__title'>已复查结果</h2>
                    <button class='project-column-heading__options'><i class="fas fa-ellipsis-h"></i></button>
                </div>
                {% for item in checked %}
                    <div class='task' draggable='true'>
                        <div class='task__tags'><span class='task__tag task__tag--illustration'>{{ item.result }}</span>
                            <button class='task__options'><i class="fas fa-ellipsis-h"></i></button>
                        </div>
                        <p>患者编号：{{ item.patient_id }}</p>
                        <div class='task__stats'>
                            <span><time datetime="2021-11-24T20:00:00"><i class="fas fa-flag"></i>
                                {% if item.checked == 1 %}
                                    已复查
                                {% else %}
                                    未复查
                                {% endif %}
                            </time></span>
                            &nbsp&nbsp&nbsp&nbsp&nbsp<a href="/diagnosis/result_detail/{{ item.index }}/">
                            <button type="button" class="layui-btn layui-btn-primary layui-btn-xs">详细信息</button>
                        </a>
                            &nbsp&nbsp
                            <button onclick="copyUrl(this);" class="layui-btn layui-btn-primary layui-btn-xs">复制链接
                            </button>
                            <textarea style="opacity: 0;">/diagnosis/result_detail/{{ item.index }}/</textarea>
                        </div>
                    </div>
                {% endfor %}
            </div>

            <div class='project-column'>
                <div class='project-column-heading'>
                    <h2 class='project-column-heading__title'>历史检测记录</h2>
                    <button class='project-column-heading__options'><i class="fas fa-ellipsis-h"></i></button>
                </div>
                {% for item in temp %}
                    <div class='task' draggable='true'>
                        <div class='task__tags'><span class='task__tag task__tag--illustration'>{{ item.result }}</span>
                            <button class='task__options'><i class="fas fa-ellipsis-h"></i></button>
                        </div>
                        <p>患者编号：{{ item.patient_id }}</p>
                        <div class='task__stats'>
                            <span><time datetime="2021-11-24T20:00:00"><i class="fas fa-flag"></i>
                                {% if item.checked == 1 %}
                                    已复查
                                {% else %}
                                    未复查
                                {% endif %}
                            </time></span>
                            &nbsp&nbsp&nbsp&nbsp&nbsp<a href="/diagnosis/result_detail/{{ item.index }}/">
                            <button type="button" class="layui-btn layui-btn-primary layui-btn-xs">详细信息</button>
                        </a>
                            &nbsp&nbsp
                            <button onclick="copyUrl(this);" class="layui-btn layui-btn-primary layui-btn-xs">复制链接
                            </button>
                            <textarea style="opacity: 0;">/diagnosis/result_detail/{{ item.index }}/</textarea>
                        </div>
                    </div>
                {% endfor %}
            </div>

            <div class='project-column'>
                <div class='project-column-heading'>
                    <h2 class='project-column-heading__title'>待复查</h2>
                    <button class='project-column-heading__options'><i class="fas fa-ellipsis-h"></i></button>
                </div>
                {% for item in unchecked %}
                    <div class='task' draggable='true'>
                        <div class='task__tags'><span class='task__tag task__tag--illustration'>{{ item.result }}</span>
                            <button class='task__options'><i class="fas fa-ellipsis-h"></i></button>
                        </div>
                        <p>患者编号：{{ item.patient_id }}</p>
                        <div class='task__stats'>
                            <span><time datetime="2021-11-24T20:00:00"><i class="fas fa-flag"></i>
                                {% if item.checked == 1 %}
                                    已复查
                                {% else %}
                                    未复查
                                {% endif %}
                            </time></span>
                            &nbsp&nbsp&nbsp&nbsp&nbsp<a href="/diagnosis/result_detail/{{ item.index }}/">
                            <button type="button" class="layui-btn layui-btn-primary layui-btn-xs">详细信息</button>
                        </a>
                            &nbsp&nbsp
                            <button onclick="copyUrl(this);" class="layui-btn layui-btn-primary layui-btn-xs">复制链接
                            </button>
                            <textarea style="opacity: 0;">/diagnosis/result_detail/{{ item.index }}/</textarea>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>
    </main>
</div>
<!--图标库-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/js/all.min.js'></script>

<script src="{% static 'other/js/result/script.js' %}"></script>

<script src="{% static 'layui/layui.js' %}"></script>
<script>
    function copyUrl(e) {
        //console.log(e);
        let fatherNode = e.parentNode;
        let nodeList = fatherNode.childNodes;
        //console.log(nodeList);
        let urlText = nodeList[7];
        console.log(urlText);
        urlText.select();
        document.execCommand("copy");

        layui.use('layer', function () {
            let layer = layui.layer;

            layer.msg('复制成功');
        });
    }
</script>
</body>
</html>
